IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'sp_Report_ProductDetail')
	DROP PROCEDURE dbo.sp_Report_ProductDetail
GO
CREATE PROCEDURE dbo.sp_Report_ProductDetail
	@ProductID INT
AS
BEGIN
	SET NOCOUNT ON
	SET FMTONLY OFF
	SET NO_BROWSETABLE OFF

	DECLARE @_ProductID INT
	SET @_ProductID = @ProductID

	SELECT
		p.*
		, l.LotCode
	FROM
		dbo.Products p
		LEFT JOIN dbo.Lots l ON l.LotID = p.LotID
	WHERE
		ProductID = @_ProductID
END
GO